package com.xing.book.service.impl;

import com.xing.book.dao.UserDao;
import com.xing.book.dao.impl.UserDaoImpl;
import com.xing.book.domin.User;
import com.xing.book.service.UserService;

public class UserServiceImpl implements UserService {
    private UserDao userDao=new UserDaoImpl();

    @Override
    public User login(String username, String password) {
        //密码需要加密操作
        User user = userDao.select(username, password);
        if(user==null){
            throw  new RuntimeException("用户名或者密码错误");
        }
        if(user.getFlag()==0){
            throw  new RuntimeException("用户没有激活");
        }
        return user;
    }
}
